package com.tcs.gamed.server.model;

import java.io.Serializable;

import org.slim3.datastore.Attribute;
import org.slim3.datastore.InverseModelListRef;
import org.slim3.datastore.Model;

import com.tcs.gamed.server.meta.FolderItemMeta;
import com.tcs.gamed.server.model.FolderItem;
import com.tcs.gamed.shared.model.ItemType;

/**
 * Folder class
 * it content FolderItems.
 * it has children reference.
 * @author karasu
 *
 */
@Model(schemaVersion = 1)
public class Folder extends FolderItem implements Serializable {

    private static final long serialVersionUID = -2767912491764826896L;
    
    @Attribute(persistent = false)
    private InverseModelListRef<FolderItem, Folder> childrenRef
        = new InverseModelListRef<FolderItem, Folder>(
                FolderItem.class,
                FolderItemMeta.get().parentRef.getName(),
                this);

    public Folder() {
        super();
        setType(ItemType.FOLDER);
    }

    public InverseModelListRef<FolderItem, Folder> getChildrenRef() {
        return childrenRef;
    }
}
